package com.fig.spring.config;

import com.fig.spring.beans.Cat;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/*@Import({Person.class, MainConfig.MyImportRegistrar.class})*/
@Configuration
@ComponentScan("com.fig.spring")
public class MainConfig {

	/*	@Bean
		public Person person() {
			Person person = new Person();
			person.setName("李斯");
			person.setAge(12);
			return person;
		}*/

	/***
	 * Bean定义信息注册中心 BeanDefinitionRegistry
	 * 图纸中心;
	 * 里面都是BeanDefinition
	 */
/*	static class MyImportRegistrar implements ImportBeanDefinitionRegistrar {
		@Override
		public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
			RootBeanDefinition catDefinition = new RootBeanDefinition();
			//catDefinition.setTargetType();
			catDefinition.setBeanClass(Cat.class);
			registry.registerBeanDefinition("tomcat",catDefinition);
		}
	}*/

}
